import { defineConfig,loadEnv } from 'vite'
import react from '@vitejs/plugin-react-swc'
import vitePluginImp from "vite-plugin-imp";
import { createHtmlPlugin } from "vite-plugin-html";
import { resolve } from "path";
// https://vite.dev/config/
export default defineConfig(({mode})=>{
  const env = loadEnv(mode, process.cwd());
return {
  base: "/admin",
  plugins: [react(),
    vitePluginImp({
      libList: [
        {
          libName: "antd",
          // style: (name) => `antd/es/${name}/style`,
        },
      ],
    }),
    createHtmlPlugin({
      inject: {
        data: {
          title: env.VITE_TITLE,
        },
      },
    }),

  ],
  // 配置路径别名
  resolve: {
      
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
}
})
